/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.util.ConverterUtil;
import com.thor.palmmall.rest.chart.AAppMainReport;
import com.thor.palmmall.spi.chart.SAppMainReport;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class AAppMainReportConverter implements Converter<SAppMainReport, AAppMainReport> {
  public static AAppMainReportConverter getInstance() {
    if (instance == null)
      instance = new AAppMainReportConverter();
    return instance;
  }

  private static AAppMainReportConverter instance;

  private AAppMainReportConverter() {
  }

  @Override
  public AAppMainReport convert(SAppMainReport source) {
    if (source == null) {
      return null;
    }
    AAppMainReport target = new AAppMainReport();
    target.setCode(source.getCode());
    target.setName(source.getName());
    target.setUuid(source.getUuid());
    target
        .setStores(ConverterUtil.convert(source.getStores(), AStoreReportConverter.getInstance()));
    return target;
  }

}
